package chatGUI;

import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

/**
 * @author Michael & Pierre
 */
/**
 * Listener to change selected contact in users list to match selected tab
 */
public class ChangeTabListener implements ChangeListener{
	
	/**
	 * To keep track of the calling instance of the platform-specific GUI
	 */
	private JavaGUI gui;
	
	/**
	 * Constructor to memorize the calling platform-specific GUI address
	 * @param ihm
	 */
	public ChangeTabListener(JavaGUI ihm) {
		this.gui = ihm;
	}
	
	/**
	 * Demands appropriate contact selection in the list according to selected tab
	 * @param event
	 */
	@Override
	public void stateChanged(ChangeEvent event) {
		gui.selectContact();
	}
}
